﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ForkCarRelationManager.db;
using ForkCarRelationManager.Controls;
using ForkCarRelationManager.DB;

namespace ForkCarRelationManager
{
    public partial class MainView : Form
    {
        private DataTable table;
        dbOperate dbo = new dbOperate();
        public MainView()
        {
            InitializeComponent();
        }
         public MainView(DataTable table)
        {
            InitializeComponent();
            this.table = table;
        }
         private void MainView_Load(object sender, EventArgs e)
         {
             this.labAccount.Text = LoginInfo.CurrentUser.AccountName;
             initForm();
         }
         private void initForm()
         {
             this.MainPanel.Controls.Clear();
            RemindControl remindControl = new RemindControl();
             remindControl.Dock = DockStyle.Fill;
             this.MainPanel.Controls.Add(remindControl);
            
         }

         /*
          * 菜单栏--首页按钮
          * */
         private void Btn_mainview_Click(object sender, EventArgs e)
         {
             this.initForm();

         }

        /*
         * 菜单栏--客户管理按钮
         * */
         private void Btn_clientmanage_Click(object sender, EventArgs e)
         {

             this.MainPanel.Controls.Clear();
             ClientControl clientControl = new ClientControl();
             clientControl.Dock = DockStyle.Fill;
             this.MainPanel.Controls.Add(clientControl);
         }
        /*
        * 菜单栏--维修管理按钮
        * */
         private void Btn_mainten_Click(object sender, EventArgs e)
         {

             this.MainPanel.Controls.Clear();
             MaintenControl maintenControl = new MaintenControl();
             maintenControl.Dock = DockStyle.Fill;
             this.MainPanel.Controls.Add(maintenControl);

         }

        /*
        * 菜单栏--分公司管理按钮
        * */
         private void Btn_scompany_Click(object sender, EventArgs e)
         {

             this.MainPanel.Controls.Clear();
             ScompanyControl companyControl = new ScompanyControl();
             companyControl.Dock = DockStyle.Fill;
             this.MainPanel.Controls.Add(companyControl);

         }
        /*
        * 菜单栏--维修人员管理按钮
        * */
         private void Btn_maintor_Click(object sender, EventArgs e)
         {

             this.MainPanel.Controls.Clear();
             MaintorControl maintorControl = new MaintorControl();
             maintorControl.Dock = DockStyle.Fill;
             this.MainPanel.Controls.Add(maintorControl);

         }
        /*
         * 菜单栏--数据统计按钮
         * */
         private void Btn_data_Click(object sender, EventArgs e)
         {
             this.MainPanel.Controls.Clear();
             Control subControl = new ChartControl();
             subControl.Dock = DockStyle.Fill;
             this.MainPanel.Controls.Add(subControl);
         }

      
        /*
        * 菜单栏--设置按钮
        * */
         private void Btn_setup_Click(object sender, EventArgs e)
         {
             this.MainPanel.Controls.Clear();
             SetControl setControl = new SetControl();
             setControl.Dock = DockStyle.Fill;
             this.MainPanel.Controls.Add(setControl);
             //SetupFrom setupform = new SetupFrom();
             //setupform.Show();
         }

         private void timer1_Tick(object sender, EventArgs e)
         {
             this.labtime.Text = System.DateTime.Now.ToString("yyyy年MM月dd日 HH时mm分ss秒");
         }

         private void MenuPanel_Paint(object sender, PaintEventArgs e)
         {

         }

         private void btn_repire_Click(object sender, EventArgs e)
         {
             this.MainPanel.Controls.Clear();
             Control subControl = new  RepireControl();
             subControl.Dock = DockStyle.Fill;
             this.MainPanel.Controls.Add(subControl);
         }

    }
}
